package cz.semjob.document.annotation;

import java.util.List;

import cz.semjob.document.annotation.metadata.Entity;
import cz.semjob.document.annotation.metadata.Relation;
import cz.semjob.document.processing.DocumentWord;

public class LabeledRelationWordsPair extends RelationWordsPair {
	
	private Relation relation;
	
	public LabeledRelationWordsPair(Relation relation, RelationWordsPair relationWordsPair) {
		super(relationWordsPair.getRelationWord1(), relationWordsPair.getRelationWord2(), relationWordsPair.getEntity1(), relationWordsPair.getEntity2());
		this.relation = relation;
	}

	public LabeledRelationWordsPair(Relation relation, List<DocumentWord> relationWord1,
			List<DocumentWord> relationWord2, Entity entity1, Entity entity2) {
		super(relationWord1, relationWord2, entity1, entity2);
		this.relation = relation;
	}

	public Relation getRelation() {
		return relation;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result
				+ ((relation == null) ? 0 : relation.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		LabeledRelationWordsPair other = (LabeledRelationWordsPair) obj;
		if (relation == null) {
			if (other.relation != null)
				return false;
		} else if (!relation.equals(other.relation))
			return false;
		return true;
	}

	
	
}
